using System;

namespace System.Collections
{
    /// <summary>
    /// An interface representing a 'queue' of items, in which items are removed in the same order that they are added
    /// </summary>
    /// <remarks>Included in the SharpMUD Framework because the .NET Framework does not abstract such a type in a purely abstract form, which therefore cannot be remoted or further expanded easily</remarks>
	public interface IQueue : System.Collections.ICollection
	{
		object Peek();
        object[] Peek(int count);

		void Enqueue(object value);
        void Enqueue(object[] values);
		
        object Dequeue();
        object[] Dequeue(int count);

        bool Contains(object value);

        object[] ToArray();

		void Clear();
	}

    /// <summary>
    /// An interface representing a 'queue' of generic items of type <typeparamref name="T"/>, in which items are removed in the same order that they are added
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <remarks>Included in the SharpMUD Framework because the .NET Framework does not abstract such a type in a purely abstract form, which therefore cannot be remoted or further expanded easily</remarks>
    public interface IQueue<T> : IQueue
    {
        /// <summary>
        /// Retrieves the next item from the queue, without removing it
        /// </summary>
        /// <returns>Returns an instance of <typeparamref name="T"/></returns>
        new T Peek();
        /// <summary>
        /// Retrieves the given number of items from the top of the queue, without removing them
        /// </summary>
        /// <param name="count">The number of items to retrieve</param>
        /// <returns>A 1-dimensional array of type <typeparamref name="T"/></returns>
        new T[] Peek(int count);

        /// <summary>
        /// Inserts the given item at the end of the queue
        /// </summary>
        /// <param name="value">An item to insert at the end of the queue</param>
        void Enqueue(T value);
        /// <summary>
        /// Inserts the given items at the end of the queue, in the order they are provided
        /// </summary>
        /// <param name="values">The items to insert at the end of the queue</param>
        void Enqueue(T[] values);

        /// <summary>
        /// Retrieves the top-most item from the queue, removing it from the queue in the process
        /// </summary>
        /// <returns>Returns an instance of type <typeparamref name="T"/></returns>
        new T Dequeue();
        /// <summary>
        /// Retrieves the given number of items from the top of the queue, removing them in the process
        /// </summary>
        /// <param name="count">The number of items to retrieve from the top of the queue</param>
        /// <returns>Returns a 1-dimensional array of type <typeparamref name="T"/></returns>
        new T[] Dequeue(int count);
        /// <summary>
        /// Converts the queue into a 1-dimensional array of type <typeparamref name="T"/>
        /// </summary>
        /// <returns>Returns a 1-dimensional array of type <typeparamref name="T"/></returns>
        new T[] ToArray();

        /// <summary>
        /// Determines if the given item exists within the queue
        /// </summary>
        /// <param name="value">The item for which presence will be checked</param>
        /// <returns>Returns <value>true</value> if the item exists within the queue, otherwise <value>false</value></returns>
        bool Contains(T value);
    }
}
